import * as echarts from "echarts";

export const proposlResultOption = (types:string[]) => {
  return {
    title: {
      top: 15,
      left: 10,
      textStyle: {
        fontSize: 16,
        color: "#fff",
      },
      text: "当前届次不同类型提案征集情况",
    },
    tooltip: {
      trigger: "axis",
      axisPointer: {
        type: "shadow",
      },
    },
    grid: {
      left: "3%",
      right: "4%",
      bottom: "3%",
      containLabel: true,
    },
    xAxis: [
      {
        type: "category",
        data: types,
        axisLine: {
          lineStyle: {
            color: "#6E7079",
          },
        },
        axisLabel: {
          interval: 0,
          margin: 10,
          color: "#6E7079",
          textStyle: {
            fontSize: 11,
          },
          rotate: "45",
        },
        axisTick: {
          alignWithLabel: true,
        },
      },
    ],
    yAxis: [
      {
        axisLabel: {
          padding: [3, 0, 0, 0],
          formatter: "{value}",
          color: "rgba(95, 187, 235, 1)",
          textStyle: {
            fontSize: 11,
          },
        },
        axisTick: {
          show: true,
        },
        axisLine: {
          lineStyle: {
            color: "rgba(66, 192, 255, .3)",
          },
        },
        splitLine: {
          lineStyle: {
            color: "rgba(255,255,255,0)",
          },
        },
      },
    ],
    dataZoom: [
      //滚动条
      {
        show: false,
        type: "slider",
        realtime: true,
        startValue: 0,
        endValue: 14,
        xAxisIndex: [0],
        bottom: "10",
        left: "30",
        height: 10,
        borderColor: "rgba(0,0,0,0)",
        textStyle: {
          color: "#05D5FF",
        },
      },
    ],
    series: [
      {
        name: "类型",
        type: "bar",
        barWidth: "10",
        color: "#2F89CF",
        data: [100, 52, 200, 334, 390, 330, 220, 220, 220, 220],
        itemStyle: {
          normal: {
            color: new echarts.graphic.LinearGradient(
              0,
              0,
              0,
              1,
              [
                {
                  offset: 0,
                  color: "rgba(5, 213, 255, 1)", // 0% 处的颜色
                },
                {
                  offset: 0.98,
                  color: "rgba(5, 213, 255, 0)", // 100% 处的颜色
                },
              ],
              false
            ),
            shadowColor: "rgba(5, 213, 255, 1)",
            shadowBlur: 4,
          },
        },
        label: {
          normal: {
            show: true,
            lineHeight: 10,
            formatter: "{c}",
            position: "top",
            textStyle: {
              color: "#fff",
              fontSize: 10,
            },
          },
        },
      },
    ],
  };
};
